import request from '@/utils/request'

/**
 * 用户登录
 */
export const login = data => {
  return request({
    method: 'POST',
    url: '/frame/login',
    data
  })
}

/**
 * 获取主页菜单的信息
 */
export const menuData = () => {
  return request({
    method: 'POST',
    url: '/frame/profile'
  })
}

// 请求获取学科列表数据
export const gettingdata = params => {
  return request({
    method: 'GET',
    url: '/subjects',
    params
  })
}

// 搜索
export const SearchSubject = params => {
  return request({
    method: 'GET',
    url: '/subjects',
    params
  })
}
// 新增学科
export const addSubject = params => {
  return request({
    method: 'POST',
    url: '/subjects',
    params
  })
}

// 请求获取标签列表
export const getTags = params => {
  return request({
    method: 'GET',
    url: '/tags',
    params
  })
}

// 获取目录列表
export const getData = params => {
  return request({
    method: 'GET',
    url: '/directorys',
    params
  })
}
/**
 * 获取用户列表
 */

export const UserData = data => {
  return request({
    method: 'GET',
    url: '/users',
    data
  })
}

/**
 * 添加用户信息
 */

export const AddUser = data => {
  return request({
    method: 'POST',
    url: '/users',
    data
  })
}

/**
 * 删除用户信息
 */

export const deleteUser = data => {
  return request({
    method: 'DELETE',
    url: `/users/${data.id}`,
    data
  })
}

/**
 * 编辑用户信息
 */

export const editUser = data => {
  return request({
    method: 'PUT',
    url: `/users/${data.id}`,
    data
  })
}
/**
 * 编辑用户信息
 */

export const simple = data => {
  return request({
    method: 'GET',
    url: ' /users/simple',
    data
  })
}
/**
 * 用户详情
 */

export const detail = data => {
  return request({
    method: 'GET',
    url: `/users/${data.id}`,
    data
  })
}
